<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of welcome
 *
 * @author Obi
 */
class Admin_tarif_kirim extends MY_Controller {

    function __construct() {
        parent::__construct();

        $cek_admin = $this->session->userdata('cek_admin');
        if (!$cek_admin)
            redirect("admin");

        $this->mtarif_kirim = new M_tarif_kirim();
        $this->mmitrapengiriman = new M_mitra_pengiriman();
    }

    function index() {

        $data['title'] = 'Data Tarif Pengiriman';

        $dt = $this->mmitrapengiriman->jml_mitra();
        $data['jml_mitra'] = $dt->jml;
        $data['list_mitra'] = $this->mmitrapengiriman->get();

        $data['list_tarif'] = $this->mtarif_kirim->biaya_pengiriman();

        $data['isi'] = 'isi';
        $this->load->view('template_admin', $data);
    }

    function update($id = NULL) {

        $data['title'] = 'Ubah Biaya Pengiriman';
        $data['list'] = $this->mtarif_kirim->cari_spesifik($id);


        $data['isi'] = 'form';
        $this->load->view('template_admin', $data);
    }

    function simpan() {
        $id = $this->input->post('id');

        $data = array(
            'harga_kirim' => $this->input->post('biaya_kirim'),
        );


        $this->mtarif_kirim->update($data, $id);

        redirect("admin_tarif_kirim");
    }

}

?>
